﻿//-------------------------------------------------------------------------------------------------
// <copyright file="LocalizeAdvisor.cs" company="Anthony Adam">
// Copyright (c) Anthony Adam 2012. All rights reserved.
// </copyright>
//-------------------------------------------------------------------------------------------------
// ReSharper disable once CheckNamespace
namespace SuperStarRounds
{
  using System.Globalization;
  using System.Resources;
  using System.Threading;

  /// <summary>
  /// Provides access to the context sensitive Help text for the Help Advisory Panel
  /// </summary>
  public static class LocalizeAdvisor
  {
    /// <summary>
    /// Resource Manager for Localised string
    /// </summary>
    private static readonly ResourceManager LocalAdvice = 
      new ResourceManager("SuperStarRounds.Localisation.AdvisorStrings", typeof(SuperStar).Assembly);

    /// <summary>
    /// Holds the culture info text code for the currently active language.
    /// </summary>
    private static string localLang;

    /// <summary>
    /// Gets the localised string for the Help Advice for the Wondrous Item item name field.
    /// </summary>
    public static string WondrousItemNameAdvice => LocalAdvice.GetString("wiItemNameAdvice");

    /// <summary>
    /// Sets the language that will be used for the application for the help text.
    /// </summary>
    /// <param name="language">The language culture code (e.g. en-US)</param>
    public static void SetLanguage(string language = "")
    {
      localLang = language.Equals(string.Empty) ? "en-US" : language;

      Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(localLang);
    }
  }
}
